package vue;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JPanel;

import controleur.CNewLevel;

@SuppressWarnings("serial")
public class VThemeItem extends JPanel {
	
	protected BufferedImage imgItem;
	
	public VThemeItem(VTheme tw, VRootWindow rw, int choixlvl, int theme) {
		try {
			imgItem = ImageIO.read(getClass().getResourceAsStream("th"+theme+".png"));
		} catch(IOException e) {}
		setPreferredSize(new Dimension(imgItem.getWidth(), imgItem.getHeight()));
		addMouseListener(new CNewLevel(tw, rw, choixlvl, theme));
	}
	
	@Override
	public void paintComponent(Graphics g) {
		g.drawImage(imgItem, 0, 0, null);
	}

}
